package com.h6.crm.service.Impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.h6.crm.entity.SysCity;
import com.h6.crm.entity.SysProvince;
import com.h6.crm.mapper.SysCityMapper;
import com.h6.crm.mapper.SysProvinceMapper;
import com.h6.crm.service.AreaService;

@Service
public class AreaServiceImpl implements AreaService {

    @Autowired
    SysProvinceMapper provinceMapper;

    @Autowired
    SysCityMapper cityMapper;

    @Override
    public List<SysProvince> queryProvinceList() {
        return provinceMapper.selectList(new LambdaQueryWrapper<SysProvince>()
                .orderByAsc(SysProvince::getProvinces));
    }

    @Override
    public List<SysCity> queryCityList(String provinceId) {
        return cityMapper.selectList(new LambdaQueryWrapper<SysCity>()
                .eq(SysCity::getProvincesId, provinceId)
                .orderByAsc(SysCity::getCity));
    }

}
